<?php
namespace Engine\Functions\Doctrine;

class RandFunction extends \Doctrine\ORM\Query\AST\Functions\FunctionNode {

    public $simpleArithmeticExpression;

    private function _offAlias($expr) {
        return substr($expr, 0, strpos($expr, ' '));
    }


    public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) {
        return 'RAND()';
    }

    public function parse(\Doctrine\ORM\Query\Parser $parser) {
        $lexer = $parser->getLexer();

        $parser->match(\Doctrine\ORM\Query\Lexer::T_IDENTIFIER);
        $parser->match(\Doctrine\ORM\Query\Lexer::T_OPEN_PARENTHESIS);
        $parser->match(\Doctrine\ORM\Query\Lexer::T_CLOSE_PARENTHESIS);
    }

}
